//
// Created by ECNU on 2024/2/22.
//

#ifndef NANO_FAISS_FAISSEXCEPTION_H
#define NANO_FAISS_FAISSEXCEPTION_H

#include <exception>
#include <string>
#include <utility>
#include <vector>

namespace faiss {

class FaissException : public std::exception {
   public:
    explicit FaissException(const std::string& msg);

    FaissException(
            const std::string& msg,
            const char* funcName,
            const char* file,
            int line);

    const char* what() const noexcept override;

    std::string msg;
};

struct TransformedVectors {
    const float *x;
    bool own_x;

    TransformedVectors(const float *origin, const float *x) : x(x) {
        own_x = origin != x;
    }

    ~TransformedVectors() {
        if (own_x) {
            delete[] x;
        }
    }
};


}

#endif // NANO_FAISS_FAISSEXCEPTION_H
